
	<div id="action" class="easyui-dialog" closed="true" style="display:none;">
		<form class="easyui-form">
			<table>

				<tr id="seesHouse">
					<td>选择小区/栋：</td>
					<td>
						<button onClick='seesHouse()'>选择小区/栋</button>
					</td>
				</tr>

				<tr>
					<td>小区名称显示：</td>
					<td>
						<input type="text" id="cellName" disabled="disabled" style="float: left;">
					</td>
				</tr>

				<tr>
					<td>栋名称显示：</td>
					<td>
						<input type="text" id="buildingName" disabled="disabled" style="float: left;">
					</td>
				</tr>

				<tr>
					<td>房号显示：</td>
					<td>
						<input type="text" id="roomNumber" disabled="disabled" style="float: left;">
					</td>
				</tr>


				<tr id="seesOwner">
					<td>选择业主：</td>
					<td>
						<button onClick='seesOwner()'>选择业主</button>
					</td>
				</tr>

				<tr>
					<td>业主手机号：</td>
					<td>
						<input type="text" id="phone" disabled="phone" style="float: left;">
					</td>
				</tr>

				<tr>
					<td>水费：</td>
					<td>
						<input name='chargeForWater' id="chargeForWater" type="text" placeholder="输入水费">
					</td>
				</tr>

				<tr>
					<td>电费：</td>
					<td>
						<input name='electricityFees' id="electricityFees" type="text" placeholder="输入电费">
					</td>
				</tr>

				<tr>
					<td>管理费：</td>
					<td>
						<input name='managementExpense' id="managementExpense" type="text" placeholder="输入管理费">
					</td>
				</tr>

				<tr>
					<td>报修费：</td>
					<td>
						<input name='repairFee' id="repairFee" type="text" placeholder="输入报修费">
					</td>
				</tr>

				<tr>
					<td>网络费：</td>
					<td>
						<input name='networkFee' id="networkFee" type="text" placeholder="输入网络费">
					</td>
				</tr>

				<tr>
					<td>垃圾费：</td>
					<td>
						<input name='garbageFee' id="garbageFee" type="text" placeholder="输入垃圾费">
					</td>
				</tr>

				<tr>
					<td>煤气押金：</td>
					<td>
						<input name='gasDeposit' id="gasDeposit" type="text" placeholder="输入煤气押金">
					</td>
				</tr>

				<tr>
					<td>违约金：</td>
					<td>
						<input name='liquidatedDamages' id="liquidatedDamages" type="text" placeholder="输入违约金">
					</td>
				</tr>

				<tr>
					<td>定金：</td>
					<td>
						<input name='deposit' id="deposit" type="text" placeholder="输入定金">
					</td>
				</tr>

				<input type="hidden" name="houseID" id='houseID'>
				<input type="hidden" name="ownerID" id='ownerID'>
				<input type="hidden" name="id" id='id'>

			</table>
		</form>

	</div>

	<script type="text/javascript">

		function submit(id){

			var method = "/daoOwnerFeeStandard/ownerFeeStandardAdd";
			if(id > 0){
				var method = "/daoOwnerFeeStandard/ownerFeeStandardSaveData";
			}

	        var chargeForWater = $("#chargeForWater").val();
	        var electricityFees = $("#electricityFees").val();
	        var managementExpense = $("#managementExpense").val();
	        var repairFee = $("#repairFee").val();
	        var networkFee = $("#networkFee").val();
	        var garbageFee = $("#garbageFee").val();
	        var gasDeposit = $("#gasDeposit").val();
	        var liquidatedDamages = $("#liquidatedDamages").val();
	        var deposit = $("#deposit").val();
	        var roomNumber = $("#roomNumber").val();
	        var houseID = $("#houseID").val();
	        var ownerID = $("#ownerID").val();

	        $.messager.progress({msg:'正在增加...',interval:3000,});
			$.ajax({
				type:"post",
				url:method,
				data:{
					chargeForWater:chargeForWater,
					electricityFees:electricityFees,
					managementExpense:managementExpense,
					repairFee:repairFee,
					networkFee:networkFee,
					garbageFee:garbageFee,
					gasDeposit:gasDeposit,
					liquidatedDamages:liquidatedDamages,
					deposit:deposit,
					roomNumber:roomNumber,
					houseID:houseID,
					ownerID:ownerID,
					id:id,
				},
				cache: false,
				dataType:'html',
				success:function(data){

					var data = eval('('+data+')');
					if( data.info == 'success' ){
						
						$.messager.progress('close');
						$('#action').dialog('close');
						$('#data').datagrid('reload');
					} else {
						
						$.messager.progress('close');
						$.messager.alert('提示信息', data.info);
					}
				}
			});

		}

		function doAdd(id, data){

			$("#action form").form('reset');

			var title = '新增';
			$("#seesHouse").show();	// 171021. 判断重复值，选择的方案，无法关系两张表问题，最后只能选择关系一张表问题
			// $("#seesOwner").show();	// 171021. 判断重复值，选择的方案，无法关系两张表问题，最后只能选择关系一张表问题
			// 
			if(id > 0){
				var title = '修改';
				$("#seesHouse").hide(); // 171021. 判断重复值，选择的方案，无法关系两张表问题，最后只能选择关系一张表问题
				// $("#seesOwner").hide(); // 171021. 判断重复值，选择的方案，无法关系两张表问题，最后只能选择关系一张表问题

				$("#cellName").val(data.cellName);
				$("#buildingName").val(data.buildingName);
				$("#roomNumber").val(data.roomNumber);
				$("#phone").val(data.phone);
				$("#chargeForWater").val(data.chargeForWater);
				$("#electricityFees").val(data.electricityFees);
				$("#managementExpense").val(data.managementExpense);
				$("#repairFee").val(data.repairFee);
				$("#networkFee").val(data.networkFee);
				$("#garbageFee").val(data.garbageFee);
				$("#gasDeposit").val(data.gasDeposit);
				$("#liquidatedDamages").val(data.liquidatedDamages);
				$("#deposit").val(data.deposit);

				$("#houseID").val(data.houseID);
				$("#ownerID").val(data.ownerID);
				$("#id").val(data.id);

			}else{
				// authority.list();
			}

			$('#action').show();
			$('#action').dialog('open').dialog({
				title:title,    
				width:"100%",    
				height:"100%",
				closed:false,    
				cache:false,    
				modal:true,
				closable:true, 
				left:0,
				top:0,
				buttons:[{
					text:'确定',
					width:'56',
					handler:function(){

						submit(id);
					}
				},{
					text:'取消',
					width:'56',
					handler:function(){

						$('#action').dialog('close');
					}
				}],
			});

		}

		// 父窗口关闭弹框方法
        function parentWindowClosedHouse(id, cellName, buildingName, roomNumber) {

        	$("#houseID").val(id);
        	$("#cellName").val(cellName);
        	$("#buildingName").val(buildingName);
        	$("#roomNumber").val(roomNumber);
        	
            $("#bombBox").dialog("close");
            $('#data').datagrid('reload');   
        }

		// 弹框方法
		function seesHouse(id){

			var url = '/adminOwnerFeeStandard/adminOwnerFeeStandardAddHouse';
			var content = '<iframe id="iframeBombBox" scrolling="auto" frameborder="0" src="'
						+ url + '" style="width:100%;height:100%;"></iframe>';
			$('#bombBox').dialog({
			    title: '用户',
			    width: '100%',
			    height: '100%',
			    modal: true,
			    content: content,
			    scroll: false,
			}); 
		}

		// 父窗口关闭弹框方法
        function parentWindowClosedOwner(id, phone) {

        	$("#ownerID").val(id);
        	$("#phone").val(phone);
        	
            $("#bombBox").dialog("close");
            $('#data').datagrid('reload');   
        }

		// 弹框方法
		function seesOwner(id){

			var url = '/adminOwnerFeeStandard/adminOwnerFeeStandardAddOwner';
			var content = '<iframe id="iframeBombBox" scrolling="auto" frameborder="0" src="'
						+ url + '" style="width:100%;height:100%;"></iframe>';
			$('#bombBox').dialog({
			    title: '用户',
			    width: '100%',
			    height: '100%',
			    modal: true,
			    content: content,
			    scroll: false,
			}); 
		}


	</script>
